package com.szrt.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * 监听 application 生  死
 * @author zsrt
 *
 */
public class ScottServletContextListener implements  ServletContextListener {

	/*public static int COUNTER=0;*/

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		System.out.println("初始化....");
		
		ServletContext application = sce.getServletContext();
		System.out.println(application);
		
		//重点
		application.setAttribute("user", 0);
		
	}

	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		System.out.println("销毁...");
	}

}
